<?php	
	// TODO Make this messy code better (MVC? Implement it in the datatypes MVC?)
	
	include_once('ajax.init.php');
	
	if(!isset($nr)) { $nr = $_GET['nr']; }
	
	echo '<li>';
	echo '<select name="option_'.$nr.'">';
	$ajaxResult = $db->select('id,name', 'options', array('orderby'=>'name'));
	while($info = mysql_fetch_assoc($ajaxResult)) {
		$selected = '';
		if(isset($id_option)) {
			if($info['id']==$id_option) {
				$selected = ' selected="selected" ';
			}
		}
		echo '<option value="'.$info['id'].'"'.$selected.'>'.$info['name'].'</option>';
	}
	$checked = $hasmany ? ' checked="checked" ' : '';
	echo '</select> <input type="checkbox" '.$checked.' name="many_'.$nr.'" /> Has many | <a href="#" class="delete">delete</a></li>';
?>
